package com.zlaidyrac.weride.ui;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;

import com.zlaidyrac.weride.main.Common;
import com.zlaidyrac.weride.persistence.SearchResult;
import com.zlaidyrac.weride.persistence.User;
import com.zlaidyrac.weride.webclient.WebClient;

import com.zlaidyrac.weride.main.R;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;


public class RideSearchResultsListActivity extends Activity {
	public static final String FB_FRIEND_IMAGE_PATH = "weride/friend_fb_img.png";
	Intent viewMyRide;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.search_results_list);
		viewMyRide = new Intent(this, com.zlaidyrac.weride.ui.ViewMyRide.class);
		Intent intent = getIntent();
		ArrayList<SearchResult> mylist = Common.searchResults;
		final ListView resultsList = (ListView)findViewById(R.id.search_results_listview);
		ArrayAdapter<SearchResult> adapter = new ArrayAdapter<SearchResult>(this, android.R.layout.simple_list_item_2,
				android.R.id.text2, mylist);
		
		resultsList.setAdapter(adapter);
		resultsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			
			@Override
			public void onItemClick(AdapterView<?> adapterView, View view, int position,
					long id) {
				Common.current_searchresult = (SearchResult)resultsList.getItemAtPosition(position);
				startActivity(viewMyRide);
			}
		});
		 
	}
	
	
	

}
